<!DOCTYPE html>
<html>
<head>
    <title>违章查询</title>
    <script type="text/javascript" src="/js/layout.js"></script>
    <script type="text/javascript">
        $(function () {
            function MyViewModel() {
                var self = this;

                self.hphm = ko.observable('BP0542');
                self.fdjh = ko.observable('BB223522');

                self.search = function () {
                    jsonrpc.invoke({
                        method: 'ajax',
                        params: {
                            url: 'http://sslk.bjjtgl.gov.cn/jgjww/wzcx/wzcx_result.jsp',
                            method: 'POST',
                            headers: {
                                'Content-Type': 'application/x-www-form-urlencoded',
                                'Referer': 'http://sslk.bjjtgl.gov.cn/jgjww/wzcx/wzcx_yzm.jsp?flag=1',
                                'Host': 'sslk.bjjtgl.gov.cn',
                                'Origin': 'http://sslk.bjjtgl.gov.cn'
                            },
                            data: {
                                sf: '11',
                                fdjh: self.fdjh(),
                                hpzl: '02',
                                hphm:  self.hphm(),
                                yxqz: '2013-08-31',
                                carno: ''
                            },
                            from: 'GBK',
                            to: 'UTF-8'
                        },
                        success: function (data) {
                            var body = data.result.body;
                            body = body.replace(/document.write/g, '');
                            body = body.replace(/\.\.\//g, 'http://sslk.bjjtgl.gov.cn/jgjww/');
                            $('#wz').html(body);
                        }
                    });
                }
            }

            ko.applyBindings(new MyViewModel());
        });
    </script>
</head>
<body>
    车牌号<input type="text" data-bind="value:hphm" />
    发动机号<input type="text" data-bind="value:fdjh" />
    <input type="button" value="Search" data-bind="click:search" />
    <div id="wz">
    </div>
</body>
</html>
